using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using WalkingTec.Mvvm.Core;
using WalkingTec.Mvvm.Mvc;
using HengTong.Services;
using TiaoTaoHelper.Wtm.Attributes;

namespace HengTong.Areas.SupplyChain.Controllers
{
    [AuthorizeJwtWithCookie]
    public partial class SysMeasureUnitController(DataSyncService service)
    {
        /// <summary>
        /// 和EAS进行数据同步
        /// </summary>
        /// <returns></returns>
        [HttpGet("Sync")]
        [PreventDuplicateSubmit]
        [ActionDescription("数据同步")]
        public async Task<IActionResult> Sync()
        {
            await service.MeasureUnitSync();
            return Ok("数据同步开始执行, 请稍后刷新页面查看同步结果");
        }
    }
}
